Skip to content

Conversation

@jfrasunk
Copy link
Contributor

@jfrasunk jfrasunk commented Jun 5, 2025

The new function reads tomographic models from NetCDF files and generates the corresponding GeoData structure. The function is tested with a small test.nc file.

@github-actions
Copy link

github-actions bot commented Jun 5, 2025

Your PR requires formatting changes to meet the project's style guidelines.
Please consider running Runic (git runic main) to apply these changes.

Click here to view the suggested changes.
diff --git a/src/data_import.jl b/src/data_import.jl
index e983f30..d6cbbdf 100644
--- a/src/data_import.jl
+++ b/src/data_import.jl
@@ -366,15 +366,15 @@ function tomo_2_GeoData(filename::String; vel_type::String = "vs")
 
     # Extract the variables
     depth = data["depth"][:]
-    lon   = data["longitude"][:]
-    lat   = data["latitude"][:]
-    vel   = data[vel_type][:,:,:]
+    lon = data["longitude"][:]
+    lat = data["latitude"][:]
+    vel = data[vel_type][:, :, :]
 
     # create lon, lat, depth grid
     Lon, Lat, Depth = lonlatdepth_grid(lon, lat, .- depth)
 
     # create GeoData struct
-    Tomo_data = GeoData(Lon, Lat, Depth, (vel=vel,))
+    Tomo_data = GeoData(Lon, Lat, Depth, (vel = vel,))
 
     return Tomo_data
-end
\ No newline at end of file
+end
diff --git a/test/test_GMT.jl b/test/test_GMT.jl
index 9528ef3..d50cee6 100644
--- a/test/test_GMT.jl
+++ b/test/test_GMT.jl
@@ -2,10 +2,10 @@ using Test
 using GeophysicalModelGenerator, GMT
 
 Topo = import_topo(lon = [8, 9], lat = [50, 51])
-@test sum(Topo.depth.val) ≈ 1076.7045 rtol = 1e-1
+@test sum(Topo.depth.val) ≈ 1076.7045 rtol = 1.0e-1
 
 Topo = import_topo([8, 9, 50, 51]);
-@test sum(Topo.depth.val) ≈ 1076.7045 rtol = 1e-1
+@test sum(Topo.depth.val) ≈ 1076.7045 rtol = 1.0e-1
 
 test_fwd = import_GeoTIFF("test_files/length_fwd.tif", fieldname = :forward)
 @test  maximum(test_fwd.fields.forward) ≈ 33.17775km
diff --git a/test/test_data_import.jl b/test/test_data_import.jl
index 3b71606..5223778 100644
--- a/test/test_data_import.jl
+++ b/test/test_data_import.jl
@@ -93,10 +93,10 @@ tomo_file = "test_files/test_tomo_data.nc"
 Tomo_data = tomo_2_GeoData(tomo_file)
 test_array = [i for i in 0:1:10]
 
-@test Tomo_data.lon.val[:,1,1] ≈ test_array
-@test Tomo_data.lat.val[1,:,1] ≈ test_array
-@test Tomo_data.depth.val[1,1,:] ≈ .- test_array
+@test Tomo_data.lon.val[:, 1, 1] ≈ test_array
+@test Tomo_data.lat.val[1, :, 1] ≈ test_array
+@test Tomo_data.depth.val[1, 1, :] ≈ .- test_array
 
 for i in eachindex(test_array)
-    @test Tomo_data.fields.vel[i,i,i] ≈ i
-end
\ No newline at end of file
+    @test Tomo_data.fields.vel[i, i, i] ≈ i
+end

Copy link
Member

@boriskaus boriskaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!
Few requests:

  1. Can you add this to the documentation as well (simply list the function)
  2. It seems that GMT tests are failing in a different part. Could you please fix those tests?

@jfrasunk
Copy link
Contributor Author

jfrasunk commented Jun 5, 2025

The GMT test is now adapted and requested changes were made, but still some tests are failing

@jfrasunk jfrasunk requested a review from boriskaus June 5, 2025 15:13
@boriskaus boriskaus merged commit 0c5510c into JuliaGeodynamics:main Jun 5, 2025
16 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants